home *** CD-ROM | disk | FTP | other *** search
/ Leisure Game Pak 1 / Leisure Game Pak I.iso / bin / lpmenu.pas < prev    next >
Pascal/Delphi Source File  |  1994-08-17  |  2KB  |  112 lines

  1. Program M2;
  2.  
  3. { SPX library - Parallax demo  Copyright 1993 Scott D. Ramsay  }
  4. {$A-,B-,D+,E-,F-,G+,I-,L+,N-,O-,R-,S-,V-,X+} {TP 6.0 & 286 required!}
  5.  
  6.  
  7.  
  8. Uses   eco_env,dos,crt,
  9. spx_gui,spx_vga,spx_txt,spx_eff,spx_key,spx_img,spx_fnc,
  10. mouse;
  11.  
  12. const
  13.   path = '\bin\';    { default work path }
  14.   menumax =9;
  15.  
  16.  
  17. var
  18.  menuno : integer;
  19.  loadpic : boolean;
  20.  byeno : integer;
  21.  mb0,mb1,mx,my : integer; {mouse button,x,y}
  22.  p,q  : pButton;
  23.  
  24.   e      :  envrec;
  25.   ss     :  string;
  26.   vs     :  string;
  27.   status : integer;
  28.  
  29.  
  30.  
  31.  
  32. Procedure Procloadpic;
  33.  begin
  34.   mouseoff;
  35.   loadpcx(path+'menublk'+chr(48+menuno)+'.pcx'); { load pcx file on page 2 }
  36.   fsetcolors(rgb256);       { set the palette to the pcx palette }
  37.   mouseon;
  38.   loadpic :=false;
  39.   repeat
  40.    getmouse(mb0,mx,my);
  41.   until (mb1<>mb0) or anykey;
  42.  end;
  43.  
  44.  
  45.  
  46.  procedure nextmenu(i:integer);
  47.    begin
  48.      menuno:=menuno+i;
  49.      loadpic:=true;
  50.       if menuno>menumax then menuno:=0;
  51.       if menuno<0 then menuno:=menumax;
  52.      end;
  53.  
  54.  
  55. function mouseat(x,y : integer) : boolean;
  56.  begin
  57.   mouseat :=(abs((x+40)-mx/2)<41) and (abs((y+25)-my)<26);
  58.  end;
  59.  
  60.  
  61.  
  62. begin
  63.   menuno:=vl(getenv('game')) div 10;
  64.   openmode(1);
  65.   setpageactive(1);
  66.   setpageactive(1);
  67.  
  68.   mousereset;
  69.   setdefptr;
  70.  
  71.   menuno:=vl(getenv('game')) div 10;
  72.   loadpic := true;
  73.   byeno:=100;
  74.  
  75.   {Main loop}
  76.   repeat
  77.    if loadPic then Procloadpic;
  78.    getmouse(mb0,mx,my);
  79.    delay(200);
  80.    getmouse(mb1,mx,my);
  81.  
  82.    if mb0<>mb1 then {keypressed}
  83.  
  84.     begin
  85.  
  86.      if mouseat(20,10) then byeno:=1+menuno*10;
  87.      if mouseat(20,10+50+10) then byeno:=4+menuno*10;
  88.      if mouseat(20,10+50+10+50+10) then byeno:=7+menuno*10;
  89.  
  90.      if mouseat(20+80+10,10) then byeno:=2+menuno*10;
  91.      if mouseat(20+80+10,10+50+10) then byeno:=5+menuno*10;
  92.      if mouseat(20+80+10,10+50+10+50+10) then byeno:=8+menuno*10;
  93.  
  94.      if mouseat(20+80+10+80,10) then byeno:=3+menuno*10;
  95.      if mouseat(20+80+10+80,10+50+10) then byeno:=6+menuno*10;
  96.      if mouseat(20+80+10+80,10+50+10+50+10) then byeno:=9+menuno*10;
  97.  
  98.  
  99.  
  100.      if (mx/2>300) and (my>180) then nextmenu(-1);
  101.      if (mx/2>300) and (my<20) then nextmenu(1);
  102.      if (mx/2<12) and (my<20) then byeno:=0;
  103.     end;
  104.   until byeno<100;
  105.   FadeOut(30,rgb256);
  106.   closemode;
  107.   textmode(co80);
  108.   masterenv(e);
  109.   writeln('Game :' , byeno:4);
  110.   setenvstr(e, 'game', lz(byeno,2)) ;
  111. end.
  112.